#########################
### Indigenous population plot for supplementary material
##########################

library(ggplot2)
library(dplyr)

#### REad
indian_pop <- read.csv("C://Users/franc/Dropbox/Aztec/Gerhard/indian_pop_estimated.csv")
indian_pop <- indian_pop %>% mutate(year=as.numeric(Year))
### ggplot
cols <- c("LINE1"="#f04546","LINE2"="#3591d1","BAR"="#62c76b")

p <- ggplot(indian_pop, aes(x=as.factor(Year), y=Indians,  colour="Indians", group=1)) + geom_line() + geom_line(aes(y=Others, colour="Others"))
p <- p + theme_bw() + ylab("Population in millions") + xlab("Year") + geom_vline(xintercept="1590", color="black", linetype="dashed") + ylim(0,22)
p <- p +  theme(axis.text.x = element_text(angle = 45, vjust = 0.9, hjust=1)) 
p <- p +  scale_colour_manual(name="",
                      values=c(Indians="red", Others="blue") )
p <- p  + annotate("rect", xmin = "1700", xmax = "1820", ymin = 0, ymax = 22,
           alpha = .2)
p <- p +  annotate("text", x = "1610", y = 15, label = "GIC starts")
p <- p +  annotate("text", x = "1760", y = 15, label = "Bourbon rule")
p

#ggsave(file="C:/Users/franc/Dropbox/PhD/dissertation/paper_colonialism_liberalims/tex/2019_version/online_appendix/indian_pop.png", p, width=9)
